package com.leenmvc.core.web.controller;

import com.leenmvc.core.annotation.Note;
import com.leenmvc.core.base.BaseController;
import com.leenmvc.core.dao.communal.Wrapper;
import com.leenmvc.core.security.User;
import com.leenmvc.core.security.entity.core.SysUser;
import com.leenmvc.core.web.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * 用户控制器类
 * 用户的增删改查
 * 用户权限的控制
 */
@RestController
@RequestMapping("system/sysUser")
public class SysUserController extends BaseController<SysUser> {

    /**
     * 排除自己，的所有用户
     */
    @GetMapping("getUserList")
    @Note("查询除当前用户外所有用户，查询条件AL_realName")
    public Result getUserList(@RequestParam Map<String,Object> params){
        Wrapper queryWrapper = getQueryWrapper(params);
        queryWrapper.uEq("id", User.getId());
        List<SysUser> query = query(queryWrapper);
        return new Result().ok(query);
    }

    /**
     * 排除自己，的所有用户
     */
    @GetMapping("testEmpty")
    @Note("用于测试框架性能，在业务为空的情况下的并发数")
    public String testEmpty(){
        return "ok";
    }

}
